decomposing functions h(x) = f(g(x))